home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / symmetrize.lwm < prev    next >
Text File  |  1993-12-13  |  894b  |  46 lines

  1. /* CMD: Symmetrize
  2.  * Make layer n-fold symmetric */
  3. /* By Arnie Cachelin Copyright © 1992 NewTek, Inc. */
  4.  
  5. libadd = addlib("LWModelerARexx.port",0)
  6. signal on error
  7. signal on syntax
  8.  
  9. axis.1='X'
  10. axis.2='Y'
  11. axis.3='Z'
  12.  
  13. call req_begin "n-Fold Rotational Symmetry"
  14. AxId = req_addcontrol("Axis", "CH",'X Y Z')
  15. SymId = req_addcontrol("Degree of Symmetry, n:",'N')
  16. call req_setval SymId, 6,6
  17. call req_setval AxId, 3
  18. x = req_post()
  19. if (x) then do
  20.     n= req_getval(SymId)
  21.     Ax= req_getval(AxId)
  22.     call req_end()
  23.     end
  24. else do
  25.  call req_end()
  26.  exit
  27.  end
  28.  
  29. astep=360/n
  30. a=0
  31. call COPY()      /* Get 0° version */
  32. say n astep
  33. do i=1 to n-1
  34.   call ROTATE(astep,axis.Ax,0)
  35.   call PASTE()      /* Put down 0° version */
  36.    a=a+astep
  37.   say a
  38.   end
  39. exit
  40.  
  41. syntax:
  42. error:
  43.   call end_all
  44.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  45.   if (libadd) then call remlib("LWModelerARexx.port")
  46.     exit